<table class="table table-hover sortable">
    <thead>
    <tr>
        <th data-defaultsign="az">{{ 'name'|_ }}</th>
        <th data-defaultsign="_19" style="text-align: right;">{{ 'spent'|_ }}</th>
        <th data-defaultsign="_19" style="text-align: right;">{{ 'earned'|_ }}</th>
        <th data-defaultsign="_19" style="text-align: right;">{{ 'sum'|_ }}</th>
    </tr>
    </thead>
    <tbody>
    {% for category in report %}
        {% if category.currencies|length == 0 %}
            <tr>
                <td data-value="{{ category.name }}">
                    <a href="{{ route('categories.show', category.id) }}" title="{{ category.name }}">{{ category.name }}</a>
                </td>
                <td style="text-align: right;">&mdash;</td>
                <td style="text-align: right;">&mdash;</td>
                <td style="text-align: right;">&mdash;</td>
            </tr>
        {% endif %}
        {% for currency in category.currencies %}
            <tr>
                <td data-value="{{ category.name }} ({{ currency.currency_name }})">
                    <a href="{{ route('categories.show', category.id) }}" title="{{ category.name }}">{{ category.name }} ({{ currency.currency_name }})</a>
                </td>
                <td data-value="{{ currency.spent }}" style="text-align: right;">
                    {{ formatAmountBySymbol(currency.spent, currency.currency_symbol, currency.currency_decimal_places) }}
                </td>
                <td data-value="{{ currency.earned }}" style="text-align: right;">
                    {{ formatAmountBySymbol(currency.earned, currency.currency_symbol, currency.currency_decimal_places) }}
                </td>
                <td data-value="{{ currency.sum }}" style="text-align: right;">
                    {{ formatAmountBySymbol(currency.sum, currency.currency_symbol, currency.currency_decimal_places) }}
                </td>
            </tr>
        {% endfor %}
    {% endfor %}
    </tbody>
    <tfoot>
    {% for sum in sums %}
        <tr>
            <td>{{ 'sum'|_ }} ({{ sum.currency_name }})</td>
            <td style="text-align: right;">
                {{ formatAmountBySymbol(sum.spent_sum, sum.currency_symbol, sum.currency_decimal_places) }}
            </td>
            <td style="text-align: right;">
                {{ formatAmountBySymbol(sum.earned_sum, sum.currency_symbol, sum.currency_decimal_places) }}
            </td>
            <td style="text-align: right;">
                {{ formatAmountBySymbol(sum.total_sum, sum.currency_symbol, sum.currency_decimal_places) }}
            </td>
        </tr>
    {% endfor %}
    </tfoot>
</table>
